<?php
include("config.php");
include_once('connection/connection.php');
$loc_id=$_REQUEST['addloc'];
$code=$_REQUEST['code'];
$reference_id=$_REQUEST['referenceId'];

  if(isset($_REQUEST['submit'])){
  		if($_REQUEST['code']==1) mysql_query("INSERT INTO tbl_dtls_q1_pipeline_ris_dis VALUES('','$_REQUEST[loc_id]','$_REQUEST[material]','$_REQUEST[size_mm]','$_REQUEST[length]','0','','')");
		else  mysql_query("INSERT INTO tbl_dtls_q1_pipeline_ris_dis VALUES('','$_REQUEST[loc_id]','0','0','','$_REQUEST[material]','$_REQUEST[size_mm]','$_REQUEST[length]')");
   header("location:q1_rwss_edit.php");
  }
  

 
?>
<script type="text/javascript" src="js/jquery.js"></script>

<script language="javascript">
function setReadOnly22(valobj)
{
		//document.getElementById('household'+obj).style.backgroundcolor="#eeeeee";
		//document.getElementById('population_sc1').readonly=1;
		//document.getElementById('population_sc1').value="Not Applicable";
		document.getElementById('yeildMin').disabled=true;
		document.getElementById('yeildMax').disabled=true;
		document.getElementById('waterMin').disabled=true;
		document.getElementById('waterMax').disabled=true;
		//document.getElementById('source'+obj).disabled=true;
		document.getElementById('source_status').value="defunct";
   
}
function setEnable22(valobj)
{

		//document.getElementById('population_sc1').style.backgroundcolor="#ffffff";
		//document.getElementById('population_sc1').readonly=0;
		//document.getElementById('population_sc1').value="";
		document.getElementById('yeildMin').disabled=false;
		document.getElementById('yeildMax').disabled=false;
		document.getElementById('waterMin').disabled=false;
		document.getElementById('waterMax').disabled=false;
		//document.getElementById('source'+obj).disabled=false;
		document.getElementById('source_status').value="operation";
	
}

</script>
 <div class="section_format">
  <form action="pipelinerwss_add.php" method="post" name="sec5" id="sec5" >
   	  <input type="hidden" id="loc_id" name="loc_id" value="<?php echo $loc_id; ?>">
	  <input type="hidden" id="code" name="code" value="<?php echo $code; ?>">
	
   <div style="height:30px" align="center"><?php echo $reference_id;?></div>
   <table border="1">
    <tr>
      <td colspan="2">&nbsp;<b>Pipelines</b>&nbsp;</td>
      </tr>
   
	  
	  <tr>
      <td width="138">&nbsp;<b>Material</b></td>
      <td width="144">&nbsp;
	  <select name="material" id="material" >
	   <option value="0">Select</option>
	   <?php
	  foreach($material as $mat_data){
	  echo "<option value='".$mat_data."'>".$mat_data."</option>";
	  }
	   ?>
  	    </select></td>
      </tr>
	   <tr>
      <td>&nbsp;<b>Size(mm)</b></td>
      <td>&nbsp;
	  <select name="size_mm" id="size_mm">
	  <option value="0">Select</option>
	  <?php
	  
	  foreach($size as $mm){
	  echo "<option value='".$mm."'>".$mm."</option>";
	  }
	  
	  ?>
	  </select></td>
      </tr>
	  <tr>
	  <td>&nbsp;<b>Length (Km)</b></td>
	 <td>&nbsp;<input type="text" name="length" value="" onBlur="int(this);"  /></td>
	  </tr>

	  
	  <tr>
	    <td colspan="2" align="center"><input type="submit" value="ADD PIPELINE" name="submit" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px; font-weight:bold; background:#666666; color:#FFFFFF; width:140px; height:30px" onClick="view_validate()"></td>
  </tr>
  </table>
  </form>
  </div>  